function! ExtractYoutubeLinksFunction()
  " wrapping is evil
  set nowrap
  " remove irrelevant lines
  v/watch?/d
  v/data-video-id/d
  " trim and complete full url
  g/./normal df?
  g/./normal Ihttp://www.youtube.com/watch?
  g/./normal f&D
  saveas! /tmp/tmp
endfunction

command! ExtractYoutubeLinks call ExtractYoutubeLinksFunction()
